<!-- $Id: site_add_step1.htm 7742 2007-04-02 03:54:18Z wj $ -->

{include file="pageheader.htm"}
{insert_scripts files="validator.js"}

<div class="main-div">

<form method="post" action="/admin/?controller=site&action=newsite" name="theForm"  id="theForm" enctype="multipart/form-data" onsubmit="return validate()">

<table id="group-table" >
  <tr>
    <td class="label">{$lang.site_name}</td>
    <td colspan="2"><input type="text" name="site_name" maxlength="60" value="{$site.site_name}" />{$lang.require_field}</td>
  </tr>

  <tr>
    <td class="label">{$lang.site_url}</td>
    <td colspan="2"><input type="text" name="site_url" maxlength="60" size="40" value="{$site.site_url}" /></td>
  </tr>

  <tr>
    <td class="label">{if $site.brand_logo neq ""}<a href="javascript:showNotice('warn_brandlogo');" title="{$lang.form_notice}">
        <img src="images/warning_small.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{/if}{$lang.brand_logo}130X50</td>
    <td colspan="2"><input type="file" name="brand_logo" id="logo" size="45">{if $site.brand_logo neq ""}<input type="button" value="{$lang.drop_brand_logo}" onclick="if (confirm('{$lang.confirm_drop_logo}'))location.href='brand.php?act=drop_logo&id={$site.brand_id}'">{/if}
    <br /><span class="notice-span" id="warn_brandlogo">{$lang.warn_brandlogo}</span>    </td>
  </tr>  

  <tr>
    <td class="label">
		{if $site.brand_img neq ""}
			<a href="javascript:showNotice('warn_brandlogo');" title="{$lang.form_notice}">
			<img src="images/warning_small.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>
		{/if}
		分类广告大图背景 978X（564）：</td>
    <td colspan="2"><input type="file" name="brand_img" id="logo_img" size="45">{if $site.brand_img neq ""}<input type="button" value="删除广告大图" onclick="if (confirm('确定删除广告大图吗？'))location.href='brand.php?act=drop_img&id={$site.brand_id}'">{/if}
    <br /><span class="notice-span" id="warn_brandlogo">{$lang.warn_brandlogo}</span></td>
  </tr>
  
  {if $know_img }
  {foreach from=$know_img item=item  key=key}
  <tr>
    <td class="label">{if $key == 0}学习更多品牌知识图片：{/if}
	{if $item.know_img }<a href="../{$item.know_img}"><img src="images/yes.gif" width="16" height="16" border="0" ></a>{/if}
	</td>
	<td >
			图片描述 ：<input name="know_name[]" type="text"  value="{$item.know_name}" size="10"/>
			链接地址 ：<input name="know_ul[]"   type="texit" value="{$item.know_ul}"/>
			上传文件 ：<input name="know_img[]"  type="file"   id="know_img{$key}" >
			{ if $key ==  0}
				<a href="javascript:;"  onclick="addLadder(this)"><strong>[+]</strong></a>
			{ else }
				<a href="javascript:;"  onclick="if (confirm('您确定删除图片和图片描述吗?'))location.href='brand.php?act=know_img&band_id={$site.brand_id}&id={$key}'"><strong>[-]</strong></a>
			{ /if }
	</td>
	<td>	
  </tr>
  {/foreach}
  {else}
 <tr>
	<td class="label">学习更多品牌知识图片：</td>
	<td>
		图片描述 ：<input name="know_name[]" type="text"  size="10"/>
		链接地址 ：<input name="know_ul[]"   type="texit" />
		上传文件 ：<input name="know_img[]"  type="file" />
		<a href="javascript:;"   onclick="addLadder(this)"><strong>[+]</strong></a>
	</td>
 </tr>
  {/if}


  <tr>
    <td class="label">{$lang.brand_desc}</td>
    <td colspan="2"><textarea  name="brand_desc" cols="60" rows="4"  >{$site.brand_desc}</textarea></td>
  </tr>
  <tr>
    <td class="label">{$lang.sort_order}</td>
    <td colspan="2"><input type="text" name="sort_order" maxlength="40" size="15" value="{$site.sort_order}" /></td>
  </tr>
  <tr>	
    <td class="label">{$lang.is_show}</td>
    <td colspan="2"><input type="radio" name="is_show" value="1" {if $site.is_show eq 1}checked="checked"{/if} /> {$lang.yes}
        <input type="radio" name="is_show" value="0" {if $site.is_show eq 0}checked="checked"{/if} /> {$lang.no}    </td>
  </tr>
  <tr>
    <td colspan="3" align="center"><br />
      <input type="submit" class="button" value="{$lang.button_submit}" />
      <input type="reset" class="button" value="{$lang.button_reset}" />
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="old_brandname" value="{$site.site_name}" />
      <input type="hidden" name="id" value="{$site.brand_id}" />
      <input type="hidden" name="old_brandlogo" value="{$site.brand_logo}">    </td>
  </tr>
</table>
</form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
<!--
// 检查新订单
startCheckOrder();

document.forms['theForm'].elements['site_name'].focus();
onload = function()
{
    // 开始检查订单
    startCheckOrder();
}
/**
 * 检查表单输入的数据
 */
function validate()
{
    validator = new Validator("theForm");
    validator.required("site_name",  no_brandname);
    validator.isNumber("sort_order", require_num, true);
    return validator.passed();
}

function searchGoodsResponse(result)
{
  var sel = document.forms['theForm'].elements['goods_id'];

  sel.length = 0;

  /* 创建 options */
  var goods = result.content;
  if (goods)
  {
    for (i = 0; i < goods.length; i++)
    {
      var opt = document.createElement("OPTION");
      opt.value = goods[i].goods_id;
      opt.text  = goods[i].goods_name;
      sel.options.add(opt);
    }
  }
  else
  {
    var opt = document.createElement("OPTION");
    opt.value = 0;
    opt.text  = search_is_null;
    sel.options.add(opt);
  }

  return;
}

  function addImg(obj)
  {
      var src  = obj.parentNode.parentNode;
	 
      var idx  = rowindex(src);
      var tbl  = document.getElementById('gallery-table');
      var row  = tbl.insertRow(idx + 1);
      var cell = row.insertCell(-1);
      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");
	 
  }

/**
 * 新增一个图片
 */
function addLadder(obj)
{
  var src  = obj.parentNode.parentNode;
  var idx  = rowindex(src);

  var tbl  = document.getElementById('group-table');
  var row  = tbl.insertRow(idx + 1);
  var cell = row.insertCell(-1);
  cell.innerHTML = '';
  var cell = row.insertCell(-1);
  cell.innerHTML = src.cells[1].innerHTML.replace(/(.*)(addLadder)(.*)(\[)(\+)/i, "$1removeLadder$3$4-");;
}

/**
 *	删除图片上传
 */
function removeLadder(obj)
{
  var row = rowindex(obj.parentNode.parentNode);
  var tbl = document.getElementById('group-table');
  tbl.deleteRow(row);
}

  /**
   * 删除图片
   */
  function dropImg(imgId)
  {
    Ajax.call('goods.php?is_ajax=1&act=drop_image', "img_id="+imgId, dropImgResponse, "GET", "JSON");
  }
  
//-->
</script>
{/literal}
{include file="pagefooter.htm"}